#ifndef _NOTIFICATIONTEST_
#define _NOTIFICATIONTEST_

#include "Core/Notification/Notification.h"
#include "Core/Notification/NotificationHandler.h"
#include "UnitTest.h"

class NotificationTest : public UnitTest
{
private:
	class Handler1 : public Core::Notification::NotificationHandler
	{
	public:
		int32 toto;

		Handler1() : NotificationHandler()
		{
			Register(Core::Notification::Unknown);
		}

		~Handler1()
		{
			Unregister(Core::Notification::Unknown);
		}

		void Handle(const Core::Notification::Notification & _notification)
		{
			if (_notification.GetType() == Core::Notification::Unknown)
				toto=10;
		}
	};

	class Handler2 : public Core::Notification::NotificationHandler
	{
	public:

		int32 toto;

		Handler2() : NotificationHandler()
		{
			Register(Core::Notification::Unknown);
		}

		~Handler2()
		{
			Unregister(Core::Notification::Unknown);
		}

		void Handle(const Core::Notification::Notification & _notification)
		{
			if (_notification.GetType() == Core::Notification::Unknown)
				toto=20;
		}
	};

	class Sender : public Core::Notification::NotificationHandler
	{
	public:

		void Handle(const Core::Notification::Notification & /*_notification*/)
		{
		}

		void Process()
		{
			Core::Notification::Notification notif(this, Core::Notification::Unknown);
			Notify(notif);
		}
	};

	Handler1 * m_pHandler1;
	Handler2 * m_pHandler2;
	Sender * m_pSender;

public:
	virtual const char * GetName() const;
	virtual Core::error Create();
	virtual Core::error Destroy();
	virtual Core::error Execute();
};

#endif // _NOTIFICATIONTEST_
